<!--
 * @Author: 淹死De鱼5 happyjing5@sina.cn
 * @Date: 2024-03-16 01:53:16
 * @LastEditors: 淹死De鱼5 happyjing5@sina.cn
 * @LastEditTime: 2024-04-06 23:42:37
 * @FilePath: \vue-ruoyi-drp\src\views\reward\contact\components\check.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<!--  -->
<template>
  <el-dialog v-bind="$attrs" title="审核" :visible.sync="visibleComputed" width="750px" append-to-body>
    <el-form ref="form" :model="form" :rules="rules" label-width="85px">
      <el-form-item label="状态" prop="contactStatus">
          <!-- <el-input v-model="form.shareIsActive" placeholder="请输入分享码是否激活" /> -->
          <el-radio-group  v-model="form.contactStatus" clearable>
          <!-- <el-radio
            v-for="dict in dict.type.sys_share_status"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          /> -->
          <el-radio v-for="dict in dict.type.check_task_status" :key="dict.value" :label="dict.value">{{ dict.label }}</el-radio>
        </el-radio-group>
        </el-form-item>
      <el-form-item label="备注" prop="remark">
        <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="submitForm">确 定</el-button>
      <el-button @click="cancel">取 消</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { checkContact } from "@/api/reward/contact.js";
export default {
  dicts: ['check_task_status'],
  components: {},
  props: {
    visible: {
      type: Boolean,
      default: false
    },
    record: {
      type: Object,
      default: () => ({})
    }
  },
  data () {
    return {
      // 表单校验
      rules: {
        contactStatus: [
          { required: true, message: "状态不能为空", trigger: "blur" }
        ],
      }
    }
  },
  computed: {
    form() {
      return this.record
    },
    visibleComputed: {
      get() {
        return this.visible
      },
      set(value) {
        return this.$emit('update:visible', value)
      }
    }
  },
  mounted() {},
  methods: {
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
         const postData = {
          contactId: this.form.contactId,
          contactStatus: this.form.contactStatus,
          remark: this.form.remark
         }
         this.cancel()
         checkContact(postData).then((result) => {
          this.$modal.msgSuccess("修改成功");
         }).finally(() => {
          this.cancel()
         })
        }
      });
    },
    cancel() {
      this.$emit('update:visible', false)
      this.$emit('cancelHandle')
    }
  }
}
</script>
<style lang='scss' scoped>
</style>
